from resource_management import *
from resource_management.core.logger import Logger
from resource_management.libraries.functions import format
from resource_management.libraries.functions.check_process_status import check_process_status


class Slave(Script):
    def install(self, env):
        import params
        env.set_params(params)
        Logger.info("this is install method")
    # To stop the service, use the linux service stop command and pipe output to log file
    def stop(self, env):
        Logger.info("this is stop method")
    # To stop the service, use the linux service stop command and pipe output to log file

    # To start the service, use the linux service start command and pipe output to log file
    def start(self, env):
        Logger.info("this is start method")

    def configure(self, env, upgrade_type=None, config_dir=None):
        import params
        Logger.info("ddse-config tomcat port:" + params.servlet_server_port)

    # To get status of the, use the linux service status command
    def status(self, env):
        import status_params
        env.set_params(status_params)
        check_process_status(status_params.webapp_pid)


if __name__ == "__main__":
    Slave().execute()
